//
//  OrderTableViewCell.m
//  XRSquare
//
//  Created by UaenaMo on 2018/8/17.
//  Copyright © 2018年 UaenaMo. All rights reserved.
//

#import "OrderTableViewCell.h"

@interface OrderTableViewCell ()
{
    UILabel * titleLabel;
    UIImageView * selectionType;
    UILabel * timeLabel;
}
@end

@implementation OrderTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth, 20)];
        titleLabel.font = [UIFont systemFontOfSize:15];
        titleLabel.textColor = [UIColor grayColor];
        [self addSubview:titleLabel];
        
        selectionType = [[UIImageView alloc]initWithFrame:CGRectMake(ScreenWidth - 40, 10, 20, 20)];
        [self addSubview:selectionType];
        
        timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(10, 10, ScreenWidth - 20, 20)];
        timeLabel.textAlignment = NSTextAlignmentRight;
        timeLabel.font = [UIFont systemFontOfSize:15];
        timeLabel.textColor = [UIColor grayColor];
        [self addSubview:timeLabel];
        
        UIView * line = [[UIView alloc]initWithFrame:CGRectMake(0, 39, ScreenWidth, 1)];
        line.backgroundColor = [UIColor colorFromHexCode:@"f3f3f3"];
        [self addSubview:line];
    }
    return self;
}

+(CGFloat)height
{
    return 40;
}

-(void)loadData:(NSString *)title seleciton:(BOOL)selection textd:(NSString *)text
{
    titleLabel.text = title;
    if (selection)
    {
        selectionType.image = [UIImage imageNamed:@"ios-circle-filled"];
    }
    else
    {
        selectionType.image = [UIImage imageNamed:@"ios-circle-outline"];
    }
    timeLabel.text = text;
    if ([title isEqualToString:@"时间选择"])
    {
        selectionType.image = nil;
    }
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
